package com.prs.crm.domain.cdxh;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.sale.ReturnsDetail;

@Entity
@Table(name = "cdxh_saleorder")
public class SaleOrder extends BaseEntity {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	/**
	 * 销售订单编号
	 */
	private String saleOrderCode;

	private String cusName; // 客户名称
	private String cusCode; // 客户编码
	private String cusTel; // 电话1
	private String saleNum; // 订单编号
	private String saleAddress; // 地址
	private Date saleDate; // 销售日期
	private String sellerName; // 销售者
	private String registerName;// 登记者
	private String cusStyle; // 客户分类 类型
	private float totalPrice; // 总计（元）
	private String rushOrder; // 是否急单
	/**
	 * 默认“0” 当为1=配料中 当为2=成型中 当为3=印刷中 当为4=配送
	 */
	private int saleState; // 状态
	/**
	 * 生产计划数量确定状态
	 */
	@Column(columnDefinition = "Integer(11) default '0'")
	private int proPlanNums;

	private String cusRmark; // 备注

	@OneToMany(mappedBy = "saleOrder")
	@Cascade({ org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<SaleOrderDetail> details;

	public float getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(float totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getRushOrder() {
		return rushOrder;
	}

	public void setRushOrder(String rushOrder) {
		this.rushOrder = rushOrder;
	}

	public String getCusName() {
		return cusName;
	}

	public void setCusName(String cusName) {
		this.cusName = cusName;
	}

	public String getCusCode() {
		return cusCode;
	}

	public void setCusCode(String cusCode) {
		this.cusCode = cusCode;
	}

	public String getSaleNum() {
		return saleNum;
	}

	public void setSaleNum(String saleNum) {
		this.saleNum = saleNum;
	}

	// public void addDetail(SaleOrderDetail detail) {
	// if (details == null)
	// details = new HashSet<SaleOrderDetail>();
	// detail.setSaleOrder(this);
	// details.add(detail);
	// }
	public Date getSaleDate() {
		return saleDate;
	}

	public void setSaleDate(Date saleDate) {
		this.saleDate = saleDate;
	}

	public String getSellerName() {
		return sellerName;
	}

	public void setSellerName(String sellerName) {
		this.sellerName = sellerName;
	}

	public String getRegisterName() {
		return registerName;
	}

	public void setRegisterName(String registerName) {
		this.registerName = registerName;
	}

	public String getCusStyle() {
		return cusStyle;
	}

	public void setCusStyle(String cusStyle) {
		this.cusStyle = cusStyle;
	}

	public int getSaleState() {
		return saleState;
	}

	public Set<SaleOrderDetail> getDetails() {
		return details;
	}

	public void setDetails(Set<SaleOrderDetail> details) {
		this.details = details;
	}

	public void setSaleState(int saleState) {
		this.saleState = saleState;
	}

	public String getCusRmark() {
		return cusRmark;
	}

	public void setCusRmark(String cusRmark) {
		this.cusRmark = cusRmark;
	}

	public String getSaleAddress() {
		return saleAddress;
	}

	public void setSaleAddress(String saleAddress) {
		this.saleAddress = saleAddress;
	}

	public String getCusTel() {
		return cusTel;
	}

	public void setCusTel(String cusTel) {
		this.cusTel = cusTel;
	}

	public String getSaleOrderCode() {
		return saleOrderCode;
	}

	public void setSaleOrderCode(String saleOrderCode) {
		this.saleOrderCode = saleOrderCode;
	}

	public int getProPlanNums() {
		return proPlanNums;
	}

	public void setProPlanNums(int proPlanNums) {
		this.proPlanNums = proPlanNums;
	}

}
